package com.liveinstars.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

//注意限定配置扫描范围 目前需要扫描当前消费者的包和它依赖的公共api的配置包
@SpringBootApplication(scanBasePackages = {"com.liveinstars.demo","com.liveinstars.api.config"})
@EnableEurekaClient
//同样注意限定扫描Feign-api的的范围，最好是需要消费哪些，才扫描哪些 ... 噗，统一配置是不是更好点
@EnableFeignClients(basePackages = "com.liveinstars.api")
public class ConsumerApplication {

    @Bean
    @LoadBalanced
    RestTemplate restTemplate() {
        return new RestTemplate();
    }

    public static void main(String[] args) {
        SpringApplication.run(ConsumerApplication.class, args);
    }

}
